﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace WebApplication1
{
    public partial class Login : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                HttpCookie cookie = Request.Cookies["UserLogin"];
                if (cookie != null)
                {
                    //check Login();
                    //txtUsername.Text = cookie["Username"].ToString();
                    //txtPassword.Text = cookie["Password"].ToString();
                    //txtRealname.Text=cookie["Fullname"].ToString();
                    Response.Redirect("Home.aspx");
                }
                
            }            
        }

        protected void btnLogin_Click(object sender, EventArgs e)
        {
            HttpCookie cookie = new HttpCookie("UserLogin");
            cookie["Username"] = txtUsername.Text;
            cookie["Password"] = txtPassword.Text;
            cookie["Fullname"] = txtRealname.Text;
            cookie.Expires = DateTime.Now.AddDays(30);
            Response.Cookies.Add(cookie);
            Response.Redirect("Home.aspx");
        }
    }
}